package com.leftheart.service.impl;

import com.leftheart.entity.Rental;
import com.leftheart.mapper.RentalMapper;
import com.leftheart.service.RentalService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RentalServiceImpl implements RentalService {

    @Autowired
    RentalMapper rentalMapper;

    @Override
    public List<Rental> queryAllRental() {
        return rentalMapper.queryAllRental();
    }

    @Override
    public Rental queryRentalById(@Param("rentalId") int rentalId) {
        return rentalMapper.queryRentalById(rentalId);
    }

    @Override
    public int updateRental(Rental rental) {
        return rentalMapper.updateRental(rental);
    }

    @Override
    public Rental addRental(Rental rental) {
        return rentalMapper.addRental(rental);
    }

    @Override
    public int queryIdByName(@Param("rentalUserName") String rentalUserName) {
        return rentalMapper.queryIdByName(rentalUserName);
    }
}
